package com.sun.floatwindow.basefloat;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.telecom.Call;
import android.util.AttributeSet;
import android.widget.FrameLayout;

/**
 * @author mashanshui
 * @date 2022-08-11
 * @desc TODO
 */
public class FullScreenRadisView extends FrameLayout {
    Paint paint = new Paint();
    Path path = new Path();
    private int radius = 140;

    public FullScreenRadisView(@NonNull Context context) {
        this(context, null);
    }

    public FullScreenRadisView(@NonNull Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public FullScreenRadisView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        path.reset();
        paint.setStyle(Paint.Style.STROKE);
        paint.setStrokeWidth(30);
        paint.setAntiAlias(true);
        paint.setColor(Color.BLACK);
//        canvas.drawRect(0, 0, radius * 2, radius * 2, paint);
//        canvas.drawRect(getWidth() - radius * 2, 0, getWidth() + radius * 2, radius * 2, paint);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            canvas.drawArc(0, 0, radius * 2, radius * 2, 180, 90, false, paint);
            canvas.drawArc(getWidth() - radius * 2, 0, getWidth(), radius * 2, 0, -90, false, paint);
        }
        canvas.drawLine(radius, 0, getWidth() - radius, 0, paint);
        canvas.drawLine(0, radius, 0, getHeight(), paint);
        canvas.drawLine(getWidth(), radius, getWidth(), getHeight(), paint);
    }
}